I have my zombie game opened back up.
We had just finished off with a shot frame before I went to the MPC stuff, but I don't want this shot
frame in the way when I'm working on things, so I'm going to click on it, go down to visible and uncheck
it.
There you go.
It will still come on when we hit our little bell.
All right.
So I'm going to bring I'm going to bring Chuck Norris in right down here where the zombies are.
And I put them in the resources so you can save them off.
And then we're going to go right click, say, insert from file chuck complete, and we'll just pull
them on into the game.
Now, currently, Chuck is only going to chase after things that are one child down in the workspace.
That's how we did our find closest character.
Let's take a look inside.
Chuck, Open them up.
He's in the workspace.
We're going to go to the move.
NPC.
We're going to change the method of which he goes through The people who are who is is who is his enemy
or not his enemy.
And I'm going to add something called the collection service.
I'm just going to call it CS and I'm going to tag his enemies.
So do game get service, collection service.
Let's go down to where he finds the nearest char.
Now, here, if the character is in the workspace and they have a humanoid root party, he's going to
chase after them.
But as you may remember, our zombies that were spawning, we're spawning in a folder that's two levels
down.
And I don't want to do a get descendants, which will go all the way down into the folders.
It'll just take too long.
What we need to do is have him look for the things that are tagged as an enemy.
I will show you how to tag enemies shortly, but let's write our code to find the tag enemies right
now.
Because we're right here.
Right?
So assume that we've attacked, we've tagged some enemies, which we'll do real quick.
And we're going to make a table called Targets.
We're going to use the collection service to get tagged.
Now, notice there's a get tags, right?
We won't get tagged.
Get tags, gets the tags off of the things that you have tagged.
Get tagged.
We're going to send in the name of the tag chop target.
That's what we're going to call it.
And then we're going to get a table with all of the things that were tagged as Chuck Target, which
are which is none right now, but we're going to change it.
Don't worry.
I'm going to go right here under this workspace where we get the children and then I'm just going to
search through the targets.
Now we have to assume that the targets are going to be characters, because on the first level, right.
Fine.
First child, we're going to look for a humanoid.
So you've got to keep that in mind.
If they're players, you're going to have to tag their char.
Don't worry.
I'm going to show you how to do that.
Now let's tag our enemies, starting with the easiest method.
So I'm going to go to the game world.
Here's Chuck.
I'm going to grab these zombies right there, way over there.
Just grab them.
Pull them over so we're not spawning.
They're just sitting in the work place.
Let's grab the tag editor.
I'm up here in the banner.
I'm going to right click.
And then I look for tag editor.
Here it is, way down the bottom.
All right, so these tags are on the zombies.
The tag editor is for all the tags.
We're going to create a new tag, though.
We're going to create it for Chuck.
And we'll call it Chuck.
Target.
Chuck.
Target.
There it is.
So whatever you select, like, I have this drooling zombie selected and you check it, you tagged it.
All right, now let's select the other zombie.
Boom.
If you want to check to see if it's tagged, just select it.
There we go.
Like my landmine sign.
Nope, not tagged.
Zombie.
Yup.
Tagged.
Nice.
Now, let's go ahead and play this and see what happens when Chuck finds his tagged zombies.
You know what?
I'm going to do a print out right here for my targets.
I'm going to do a print targets equal, and I'll do targets.
And that'll print them out, too.
Let's go to view output window so we can see what's going on.
I'm going to go to my zombie game.
Yeah, I want to start from here so I could see it.
Let's hope it starts up.
Okay.
We just got an update.
Looks good.
Yeah.
Chuck kicked them all, but he died on that zombie.
We're going to have to crank up his power a little bit, but that's all right.
We got the tags.
We can open it up.
We look, we have the two drooling zombies.
Now let's add tags to the zombies that are being spawned.